<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;

class AreaSeeder extends Seeder
{
    /**
     * php artisan db:seed --class=AreaSeeder or ... 加入DatabaseSeeder
     * Run the database seeds.
     */
    public function run(): void
    {
        $sql_file = database_path('dove_area.sql');
        $sql      = file_get_contents($sql_file);
        // 获取db name
        $dbname = config('database.connections.mysql.database');
        $sql    = str_replace("dove.", "{$dbname}.", $sql);
        DB::unprepared($sql);
    }
}
